<?php
    header('Access-Control-Allow-Origin: *');
    header('Content-Type:text/html;charset=utf-8');
    $con = mysqli_connect("localhost", "root", "root", "mydb");
    $id = $_GET['id'];
    $state = $_GET['state'];
    echo $id.'$'.$state;
    if($state == 'pass'){
        $sql = "UPDATE lessonstu SET state = 'success' WHERE id = '$id';";
        $res = mysqli_query($con,$sql);
    }else if($state == 'refuse'){
        $sql = "DELETE FROM lessonstu WHERE id = '$id';";
        $res = mysqli_query($con,$sql);
    }
    if(!$res){
        echo 'no';
    }else{
        echo 'ok';
    }
    mysqli_close($con);
?>